﻿using System;
using System.Data;
using System.Web;
using Team4Mock.DAO;

namespace Team4Mock.Entity
{
    public class DepartmentEntity
    {
        DepartmentDAO dd = new DepartmentDAO();
        private int departmentid;
        private string departmentName;
        private string departmentShortDescription;
        private int contactID;
        private string addressLine1;
        private string addressLine2;
        private string addressLine3;
        private string postcode;
        private string town;
        private string county;
        private string country;
        private string typeOfBusiness;
        private string sICCode;
        private string departmentFullDescription;
        private string phoneNumber;
        private string fax;
        private string webAddress;
        private string charityNumber;
        private string companyNumber;
        private int directorateID;
        private int organisation;
        private int isactive;
        public DepartmentEntity()
        { }
        public DepartmentEntity(string departmentName, string departmentShortDescription, int contactID, string addressLine1, string addressLine2, string addressLine3, string postcode, string town, string county, string country, string typeOfBusiness, string sICCode, string departmentFullDescription, string phoneNumber, string fax, string webAddress, int directorateID)
        {
            this.departmentName = departmentName;
            this.departmentShortDescription = departmentShortDescription;
            this.contactID = contactID;
            this.addressLine1 = addressLine1;
            this.addressLine2 = addressLine2;
            this.addressLine3 = addressLine3;
            this.postcode = postcode;
            this.town = town;
            this.county = county;
            this.country = country;
            this.typeOfBusiness = typeOfBusiness;
            this.sICCode = sICCode;
            this.departmentFullDescription = departmentFullDescription;
            this.phoneNumber = phoneNumber;
            this.fax = fax;
            this.webAddress = webAddress;
            this.directorateID = directorateID;
        }

        public string DepartmentName
        {
            get { return this.departmentName; }
            set { this.departmentName = value; }
        }
        public string DepartmentShortDescription
        {
            get { return this.departmentShortDescription; }
            set { this.departmentShortDescription = value; }
        }
        public int ContactID
        {
            get { return this.contactID; }
            set { this.contactID = value; }
        }
        public int DepartmentID
        {
            get { return this.departmentid; }
            set { this.departmentid = value; }
        }
        public string AddressLine1
        {
            get { return this.addressLine1; }
            set
            {
                if (value == null)
                    throw new Exception("addressLine1 not allow nullvalue.");
                this.addressLine1 = value;
            }
        }
        public string CharityNumber
        {
            get { return this.charityNumber; }
            set { this.charityNumber = value; }
        }
        public string CompanyNumber
        {
            get { return this.companyNumber; }
            set { this.companyNumber = value; }
        }
        public string AddressLine2
        {
            get { return this.addressLine2; }
            set { this.addressLine2 = value; }
        }
        public string AddressLine3
        {
            get { return this.addressLine3; }
            set { this.addressLine3 = value; }
        }
        public string Postcode
        {
            get { return this.postcode; }
            set { this.postcode = value; }
        }
        public string Town
        {
            get { return this.town; }
            set { this.town = value; }
        }
        public string County
        {
            get { return this.county; }
            set { this.county = value; }
        }
        public string Country
        {
            get { return this.country; }
            set { this.country = value; }
        }
        public string TypeOfBusiness
        {
            get { return this.typeOfBusiness; }
            set
            {
                if (value == null)
                    throw new Exception("typeOfBusiness not allow nullvalue.");
                this.typeOfBusiness = value;
            }
        }
        public string SICCode
        {
            get { return this.sICCode; }
            set { this.sICCode = value; }
        }
        public string DepartmentFullDescription
        {
            get { return this.departmentFullDescription; }
            set { this.departmentFullDescription = value; }
        }
        public string PhoneNumber
        {
            get { return this.phoneNumber; }
            set { this.phoneNumber = value; }
        }
        public string Fax
        {
            get { return this.fax; }
            set { this.fax = value; }
        }

        public int IsActive { get; set; }

        public string WebAddress
        {
            get { return this.webAddress; }
            set { this.webAddress = value; }
        }
        public int DirectorateID
        {
            get { return this.directorateID; }
            set { this.directorateID = value; }
        }
        public int OrganisationID
        {
            get { return this.organisation; }
            set { this.organisation = value; }
        }
        public DataTable GetDataById(DepartmentEntity e)
        {
            return dd.GetDataByID(e.DirectorateID);
        }
        public void Del(DepartmentEntity e)
        {
            dd.Del(e.DepartmentID);
        }
        public DataTable GetById(DepartmentEntity e)
        {
            return dd.GetByID(e.DepartmentID);
        }
        public DataTable CopyOrg(DepartmentEntity e)
        {
            return dd.CopyOrg(e.OrganisationID);
        }
        public DataTable CopyDirec(DepartmentEntity e)
        {
            return dd.CopyDirec(e.DirectorateID);
        }
        public void Insert(DepartmentEntity a)
        {
            dd.Insert(a.DepartmentName, a.DepartmentShortDescription, a.ContactID, a.AddressLine1, a.AddressLine2, a.AddressLine3, a.Postcode, a.Town, a.County, a.Country, a.TypeOfBusiness, a.SICCode, a.DepartmentFullDescription, a.PhoneNumber, a.Fax, a.WebAddress, a.CharityNumber, a.CompanyNumber,a.DirectorateID,a.IsActive);
        }
        public void Update(DepartmentEntity a)
        {
            dd.Update(a.DepartmentName, a.DepartmentShortDescription, a.ContactID, a.AddressLine1, a.AddressLine2, a.AddressLine3, a.Postcode, a.Town, a.County, a.Country, a.TypeOfBusiness, a.SICCode, a.DepartmentFullDescription, a.PhoneNumber, a.Fax, a.WebAddress, a.CharityNumber, a.CompanyNumber, a.IsActive, a.DepartmentID);
        }
    }
}